<ul class="breadcrumb">
    <li><a href="/com/mods/list">我的Mod列表</a></li>
    <li><a href="/com/mods/list">Mod名称</a></li>
    <li><a href="/com/mods/list">教程列表</a></li>
    <li class="active">添加教程</li>
</ul>

<div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">Submit</h3>
        </div>
        <div class="panel-body">
            <button class="btn btn-primary" id="addword">确认添加</button>
        </div>
</div>

<div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">教程标题</h3>
        </div>
        <div class="panel-body">
            <input type="text" class="form-control" name="title" id="title">
        </div>
</div>
<div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">内容</h3>
        </div>
        <div class="panel-body">
            <textarea style="display:none;" id="editor"></textarea>
        </div>
</div>
<script type="text/javascript">
    loadEditor("editor");
    $("#addword").click(function(){
        var title=$("#title").val();
        var text=editor.getContent();
        var modid={$id};
        var data={modid:modid,title:title,content:text};
        if(title=="")layer.msg("标题不可为空");
        else if(text=="")layer.msg("内容不可为空");
        else{
            $.ajax({
                url:"/com/api/mods/addword",
                data:data,
                dataType:"json",
                type:"POST",
                success:function(res){
                    layer.msg(res.msg);
                    if(res.code==200){
                        window.location.href="/com/mods/list";
                    }
                }
            });
            
            
        }
    });
</script>